/*
 *  $Id: GuardianOfTheNorth.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Light.Creatures {
    public class GuardianOfTheNorth: CreatureCard {
        public GuardianOfTheNorth(): base("001_l_c_guardian_of_the_north") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Light;
            Value = 100;
            Damage = 6;
            Health = 8;
            AddManaCost(ElementType.Light, 8);
        }
        public override void SetNaturalAffects(ICollector<Affect> affects) {
            affects.Add<Affects.Fearless>();
            affects.Add(new Affects.OnDamage(DoDamage, AffectSummaryType.Local));
        }
        public override void SetAbilities(ICollector<AbilityCard> abilities) {
            abilities.Add<Abilities.GuardSpiritNorth>();
        }

        private static void DoDamage(AbstractObject target, DamageInfo damage) {
            DamageCollector collector = target.GetAffect<DamageCollector>();
            if (collector == null) {
                collector = new DamageCollector();
                target.AddAffect(collector);
            }
            collector.AddDamage(damage.RealDamage);
        }

        public class DamageCollector: SpellAffect<GuardianOfTheNorth> {
            public int Damage;

            public DamageCollector(): base(true) {
                DefaultDescription = true;
                Damage = 0;
            }

            public override string DescriptionText {
                get { return Description.GetText(Damage); }
            }

            public override bool Dispellable {
                get { return false; }
            }

            public void AddDamage(int dmg) {
                Damage += dmg;
                UpdateDescription();
            }
        }
    }
}
